<%@ page contentType="text/html;charset=UTF-8" language="java" %>
    <%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
        <%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
            <!DOCTYPE html>
            <html lang="zh-CN">

            <head>
                <meta charset="UTF-8">
                <meta name="viewport" content="width=device-width, initial-scale=1.0">
                <title>MaxGtop医院工作站 - 202321130042</title>
                <link href="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/css/bootstrap.min.css" rel="stylesheet">
                <link rel="stylesheet"
                    href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.7.2/font/bootstrap-icons.css">
                <style>
                    :root {
                        --primary: #2563eb;
                        --primary-dark: #1e40af;
                        --secondary: #64748b;
                        --success: #059669;
                        --danger: #dc2626;
                        --warning: #d97706;
                        --info: #0284c7;
                        --light: #f1f5f9;
                        --dark: #0f172a;
                        --white: #ffffff;
                        --body-bg: #f8fafc;
                        --border-color: #e2e8f0;
                        --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
                        --shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1);
                        --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
                        --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
                    }

                    * {
                        margin: 0;
                        padding: 0;
                        box-sizing: border-box;
                    }

                    body {
                        font-family: "Microsoft YaHei", system-ui, -apple-system, sans-serif;
                        background: url(./images/111.jpg) center center;
                        background-size: cover;
                        color: var(--dark);
                        min-height: 100vh;
                        display: flex;
                        flex-direction: column;
                    }

                    /* 顶部导航栏 */
                    .navbar {
                        background: var(--white);
                        box-shadow: var(--shadow);
                        padding: 1rem 2rem;
                        position: sticky;
                        top: 0;
                        z-index: 1000;
                    }

                    .navbar-brand {
                        font-size: 1.5rem;
                        font-weight: 600;
                        color: var(--primary);
                        display: flex;
                        align-items: center;
                        gap: 0.75rem;
                    }

                    .navbar-brand i {
                        font-size: 1.75rem;
                    }

                    .student-id {
                        background: var(--light);
                        padding: 0.5rem 1rem;
                        border-radius: 2rem;
                        font-size: 0.875rem;
                        color: var(--secondary);
                        margin-left: 1rem;
                    }

                    /* 主要内容区 */
                    .main-container {
                        flex: 1;
                        padding: 2rem;
                        max-width: 1800px;
                        margin: 0 auto;
                        width: 100%;
                    }

                    .content-grid {
                        display: grid;
                        grid-template-columns: 300px 1fr;
                        gap: 2rem;
                    }

                    /* 侧边栏 */
                    .sidebar {
                        background: var(--white);
                        border-radius: 1rem;
                        box-shadow: var(--shadow);
                        overflow: hidden;
                    }

                    .sidebar-header {
                        padding: 1.5rem;
                        background: var(--primary);
                        color: var(--white);
                    }

                    .sidebar-header h2 {
                        font-size: 1.25rem;
                        margin: 0;
                    }

                    .nav-menu {
                        padding: 1rem;
                    }

                    .nav-item {
                        margin-bottom: 0.5rem;
                    }

                    .nav-link {
                        display: flex;
                        align-items: center;
                        gap: 0.75rem;
                        padding: 1rem;
                        color: var(--dark);
                        text-decoration: none;
                        border-radius: 0.5rem;
                        transition: all 0.3s ease;
                    }

                    .nav-link:hover,
                    .nav-link.active {
                        background: var(--light);
                        color: var(--primary);
                    }

                    .nav-link i {
                        font-size: 1.25rem;
                    }

                    /* 主要内容 */
                    .main-content {
                        display: flex;
                        flex-direction: column;
                        gap: 2rem;
                    }

                    /* 欢迎区域 */
                    .welcome-card {
                        background: var(--white);
                        border-radius: 1rem;
                        box-shadow: var(--shadow);
                        padding: 2rem;
                        display: flex;
                        align-items: center;
                        justify-content: space-between;
                    }

                    .welcome-text {
                        display: flex;
                        align-items: center;
                        gap: 1rem;
                    }

                    .welcome-text i {
                        font-size: 2rem;
                        color: var(--primary);
                    }

                    .welcome-text h1 {
                        font-size: 1.5rem;
                        margin: 0;
                        color: var(--dark);
                    }

                    /* 搜索区域 */
                    .search-card {
                        background: var(--white);
                        border-radius: 1rem;
                        box-shadow: var(--shadow);
                        padding: 2rem;
                    }

                    .search-form {
                        display: flex;
                        gap: 1rem;
                        align-items: center;
                    }

                    .form-group {
                        flex: 1;
                    }

                    .form-control {
                        width: 100%;
                        padding: 0.75rem 1rem;
                        border: 1px solid var(--border-color);
                        border-radius: 0.5rem;
                        font-size: 1rem;
                        transition: all 0.3s ease;
                    }

                    .form-control:focus {
                        border-color: var(--primary);
                        box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.1);
                        outline: none;
                    }

                    .btn {
                        padding: 0.75rem 1.5rem;
                        border-radius: 0.5rem;
                        font-size: 1rem;
                        font-weight: 500;
                        border: none;
                        cursor: pointer;
                        transition: all 0.3s ease;
                        display: flex;
                        align-items: center;
                        gap: 0.5rem;
                    }

                    .btn-primary {
                        background: var(--primary);
                        color: var(--white);
                    }

                    .btn-primary:hover {
                        background: var(--primary-dark);
                    }

                    /* 表格区域 */
                    .table-card {
                        background: var(--white);
                        border-radius: 1rem;
                        box-shadow: var(--shadow);
                        overflow: hidden;
                    }

                    .table {
                        width: 100%;
                        border-collapse: collapse;
                    }

                    .table th {
                        background: var(--light);
                        padding: 1rem 1.5rem;
                        text-align: left;
                        font-weight: 600;
                        color: var(--secondary);
                        border-bottom: 2px solid var(--border-color);
                    }

                    .table td {
                        padding: 1rem 1.5rem;
                        border-bottom: 1px solid var(--border-color);
                    }

                    .table tr:hover {
                        background: var(--light);
                    }

                    /* 分页 */
                    .pagination {
                        display: flex;
                        justify-content: center;
                        gap: 0.5rem;
                        margin-top: 2rem;
                    }

                    .page-link {
                        padding: 0.75rem 1rem;
                        border-radius: 0.5rem;
                        background: var(--white);
                        border: 1px solid var(--border-color);
                        color: var(--dark);
                        min-width: 40px;
                        text-align: center;
                        text-decoration: none;
                        transition: all 0.3s ease;
                    }

                    .page-link:hover,
                    .page-link.active {
                        background: var(--primary);
                        color: var(--white);
                        border-color: var(--primary);
                    }

                    /* 响应式设计 */
                    @media (max-width: 1200px) {
                        .content-grid {
                            grid-template-columns: 250px 1fr;
                        }
                    }

                    @media (max-width: 992px) {
                        .content-grid {
                            grid-template-columns: 1fr;
                        }

                        .search-form {
                            flex-direction: column;
                        }

                        .form-group {
                            width: 100%;
                        }
                    }

                    @media (max-width: 768px) {
                        .navbar {
                            padding: 1rem;
                        }

                        .student-id {
                            display: none;
                        }

                        .main-container {
                            padding: 1rem;
                        }

                        .welcome-card,
                        .search-card {
                            padding: 1.5rem;
                        }

                        .table-responsive {
                            overflow-x: auto;
                        }
                    }
                </style>
            </head>

            <body>
                <!-- 顶部导航栏 -->
                <!-- 顶部导航栏 -->
                <nav class="navbar">
                    <div class="container-fluid d-flex justify-content-between align-items-center">
                        <div class="d-flex align-items-center">
                            <a class="navbar-brand" href="#">
                                <i class="bi bi-heart-pulse-fill"></i>
                                MaxGtop医院
                            </a>
                            <span class="student-id">202321130042</span>
                        </div>
                        <div class="d-flex gap-3 align-items-center">
                            <a href="./query" class="nav-link px-3">
                                <i class="bi bi-house-heart me-1"></i>
                                首页
                            </a>
                            <a href="./export" class="nav-link px-3">
                                <i class="bi bi-file-earmark-excel me-1"></i>
                                导出Excel
                            </a>
                            <a href="login.jsp" class="nav-link px-3">
                                <i class="bi bi-box-arrow-right me-1"></i>
                                退出登录
                            </a>
                        </div>
                    </div>
                </nav>

                <!-- 主要内容区 -->
                <div class="main-container">
                    <div class="content-grid">
                        <!-- 侧边栏 -->
                        <aside class="sidebar">
                            <div class="sidebar-header">
                                <h2><i class="bi bi-grid"></i> 功能导航</h2>
                            </div>
                            <nav class="nav-menu">
                                <div class="nav-item">
                                    <a href="./query" class="nav-link active">
                                        <i class="bi bi-journal-medical"></i>
                                        挂号记录管理
                                    </a>
                                </div>
                                <div class="nav-item">
                                    <a href="deptUpdate.jsp" class="nav-link">
                                        <i class="bi bi-building"></i>
                                        科室管理
                                    </a>
                                </div>
                            </nav>
                        </aside>

                        <!-- 主要内容 -->
                        <main class="main-content">
                            <!-- 欢迎区域 -->
                            <div class="welcome-card">
                                <div class="welcome-text">
                                    <i class="bi bi-person-heart"></i>
                                    <h1>${sessionScope.user.name}医生，欢迎您</h1>
                                </div>
                            </div>

                            <!-- 搜索区域 -->
                            <div class="search-card">
                                <form action="./query" method="get" class="search-form">
                                    <div class="form-group">
                                        <input type="date" name="beginDate" class="form-control" placeholder="开始日期">
                                    </div>
                                    <div class="form-group">
                                        <input type="date" name="endDate" class="form-control" placeholder="结束日期">
                                    </div>
                                    <button type="submit" class="btn btn-primary">
                                        <i class="bi bi-search"></i>
                                        查询
                                    </button>
                                </form>
                                <div class="text-danger mt-2">${requestScope.error}</div>
                            </div>

                            <!-- 表格区域 -->
                            <div class="table-card">
                                <div class="table-responsive">
                                    <table class="table">
                                        <thead>
                                            <tr>
                                                <th>编号</th>
                                                <th>患者姓名</th>
                                                <th>就诊科室</th>
                                                <th>挂号费用</th>
                                                <th>挂号时间</th>
                                            </tr>
                                        </thead>
                                        <tbody>
                                            <c:forEach var="record" items="${requestScope.records}" varStatus="status">
                                                <tr>
                                                    <td>${record.id}</td>
                                                    <td>${record.patientName}</td>
                                                    <td>${record.deptName}</td>
                                                    <td>￥${record.price}</td>
                                                    <td>
                                                        <fmt:formatDate value="${record.regTime}"
                                                            pattern="yyyy年MM月dd日 HH:mm:ss" />
                                                    </td>
                                                </tr>
                                            </c:forEach>
                                        </tbody>
                                    </table>
                                </div>
                            </div>

                            <!-- 分页 -->
                            <nav aria-label="分页导航">
                                <ul class="pagination">
                                    <li class="page-item">
                                        <a class="page-link" href="#" aria-label="上一页">
                                            <i class="bi bi-chevron-left"></i>
                                        </a>
                                    </li>
                                    <li class="page-item"><a class="page-link active" href="#">1</a></li>
                                    <li class="page-item"><a class="page-link" href="#">2</a></li>
                                    <li class="page-item"><a class="page-link" href="#">3</a></li>
                                    <li class="page-item">
                                        <a class="page-link" href="#" aria-label="下一页">
                                            <i class="bi bi-chevron-right"></i>
                                        </a>
                                    </li>
                                </ul>
                            </nav>
                        </main>
                    </div>
                </div>

                <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js"></script>
                <script>
                    document.addEventListener('DOMContentLoaded', function () {
                        // 设置日期输入框的默认值为今天
                        const today = new Date().toISOString().split('T')[0];
                        document.querySelectorAll('input[type="date"]').forEach(input => {
                            input.value = today;
                        });

                        // 表格行悬停效果
                        const tableRows = document.querySelectorAll('.table tbody tr');
                        tableRows.forEach(row => {
                            row.addEventListener('mouseover', () => {
                                row.style.backgroundColor = 'var(--light)';
                            });
                            row.addEventListener('mouseout', () => {
                                row.style.backgroundColor = '';
                            });
                        });
                    });
                </script>
            </body>

            </html>